﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using log4net;
using SysAdmin._04_Form._00_Common;
using SysAdmin._04_Form._01_Shop;
using SysAdmin._04_Form._02_User;
using SysAdmin._04_Form._03_Order;
using SysAdmin._04_Form._04_Fee;

namespace SysAdmin._04_Form
{
    public partial class MainForm : Form
    {
        private static ILog _logger = LogManager.GetLogger(typeof(MainForm));

        public MainForm()
        {
            InitializeComponent();
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
            //Location = new Point(0 - 8, 0);
            //Width = Screen.PrimaryScreen.WorkingArea.Width + 8 + 8;
            //Height = Screen.PrimaryScreen.WorkingArea.Height + 0 + 8;
        }

        private void MainForm_Shown(object sender, EventArgs e)
        {
            var form = new ShopForm();
            form.TopLevel = false;
            panel1.Controls.Add(form);
            form.Width = panel1.Width;
            form.Height = panel1.Height;
            form.Show();

            var form2 = new UserForm();
            form2.TopLevel = false;
            panel2.Controls.Add(form2);
            form2.Width = panel2.Width;
            form2.Height = panel2.Height;
            form2.Show();

            var form3 = new OrderForm();
            form3.TopLevel = false;
            form3.Width = panel3.Width;
            form3.Height = panel3.Height;
            panel3.Controls.Add(form3);
            form3.Show();

            var form4 = new FeeForm();
            form4.TopLevel = false;
            panel4.Controls.Add(form4);
            form4.Width = panel4.Width;
            form4.Height = panel4.Height;
            form4.Show();
        }

        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (UICommonTool.ShowConfirmDialog("确定要关闭吗？"))
            {
                e.Cancel = false;
            }
            else
            {
                e.Cancel = true;
            }
        }
    }
}
